//目标：将学号为4的学生 姓名改为初音未来，性别为男
//1.加载 mysql 模块
const mysql = require('mysql');
//2.创建mysql链接对象
const conn = mysql.createConnection({
  host:"127.0.0.1",
  user:"root",
  password:"root",
  database:"myjune",
  port:3306
});
//3.通过mysql链接对象 链接服务器
conn.connect();
//4.通过mysql链接对象 执行sql语句
const sql = 'update student set sname="初音未来",sgender="男" where sno=4';
conn.query(sql,(err,result)=>{
  if(err){
    return console.log(err);
  }
  console.log(result)
});
//5.关闭链接
conn.end();
